package com.neusoft.elm.service;

import com.neusoft.elm.dao.BusinessDao;
import com.neusoft.elm.dao.impl.BusinessDaoimpl;
import com.neusoft.elm.po.Business;
import com.neusoft.elm.util.DBUtil;

import java.sql.Connection;
import java.util.List;

public class BusinessServiceimpl implements BusinessService {
    BusinessDao businessDao=new BusinessDaoimpl();
    @Override
    public List<Business> listBusinessByOrderTypeId(Integer olderTypeld) throws Exception {
        try {
            DBUtil.getConnection();
            // 不是这样Connection conn = DBUtil.getConnection();
            List<Business> list = businessDao.listBusinessByorderTypeId(olderTypeld);
            return list;
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            DBUtil.close();
        }
    }

    @Override
    public Business getBusinessById(Integer businessId) throws Exception {
        try {
//            Connection conn=null;
//            conn=DBUtil.getConnection();
            DBUtil.getConnection();
            Business business = businessDao.getBusinessById(businessId);
            return business;
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            DBUtil.close();
        }
    }
}
